package com.ruoyi.project.ins.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.aspectj.lang.annotation.Sensitive;
import com.ruoyi.framework.aspectj.lang.enums.DesensitizedType;
import com.ruoyi.framework.web.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
public class InsAccount extends BaseEntity {
    private static final long serialVersionUID = 1L;

    private Long id;

    @Excel(name = "邮箱", type = Excel.Type.ALL)
    private String email;

    @Excel(name = "手机号码", type = Excel.Type.ALL)
    private String phone;

    @Sensitive(desensitizedType = DesensitizedType.EMAIL)
    @Excel(name = "取码地址", type = Excel.Type.IMPORT)
    private String smsUrl;

    @Excel(name = "ins账号", type = Excel.Type.ALL)
    private String username;

    @Excel(name = "密码", type = Excel.Type.ALL)
    private String password;

    @Excel(name = "2FA认证码", type = Excel.Type.ALL)
    private String twoFa;

    @Excel(name = "国家码", type = Excel.Type.ALL)
    private String countryCode;

    @Excel(name = "用户id", type = Excel.Type.ALL)
    private String userId;

    @Excel(name = "IG-U-RUR", type = Excel.Type.ALL)
    private String rur;

    @Excel(name = "X-Mid", type = Excel.Type.ALL)
    private String mid;

    @Excel(name = "claim", type = Excel.Type.ALL)
    private String claim;

    @Excel(name = "X-IG-Android-ID", type = Excel.Type.ALL)
    private String androidId;

    @Excel(name = "Authorization", type = Excel.Type.ALL)
    private String auth;

    @Excel(name = "设备id", type = Excel.Type.ALL)
    private String igDid;

    @Excel(name = "账号状态", type = Excel.Type.EXPORT, readConverterExp = "0=存活,1=废弃")
    private String status;

    @Excel(name = "发消息次数", type = Excel.Type.EXPORT)
    private Integer sendTimes;

    @Excel(name = "成功消息数", type = Excel.Type.EXPORT)
    private Integer successTimes;

    /** 检测时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "检测时间", type = Excel.Type.EXPORT)
    private Date checkTime;

    @Excel(name = "检测结果", type = Excel.Type.EXPORT)
    private String checkResult;

    @Excel(name = "账号来源", type = Excel.Type.EXPORT, readConverterExp = "0=自动上传,1=批量导入,2=手工录入")
    private String sourceType;

    // 获取用户次数
    private Integer queryUserTimes;

    private String proxyServer;

    private String proxyPort;

    private String proxyCustomer;

    private String proxyPassword;

    public Integer getSendTimesOrDefault() {
        if (sendTimes == null) {
            return 0;
        }
        return sendTimes;
    }

    public Integer getQueryUserTimesOrDefault() {
        if (queryUserTimes == null) {
            return 0;
        }
        return queryUserTimes;
    }
}
